package com.chaodev.base.model;

import java.io.Serializable;
import java.time.LocalDateTime;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * tb_learning_record
 *
 * @author
 */
@ApiModel(value = "TbLeaningRecord对象", description = "学习记录表")
@Data
public class LearningRecord implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 学习记录的id
     */
    @ApiModelProperty(value = "ID值")
    private Integer id;

    /**
     * 对应课程的id
     */
    @ApiModelProperty("培训课程ID")
    private Integer trainingId;

    /**
     * 用户id
     */
    @ApiModelProperty("用户ID")
    private String userId;

    /**
     * 学习状态，0-未学习,1-学习中,2-已学完,3-已失效,默认0
     */
    @ApiModelProperty("学习状态")
    private Integer status;

    /**
     * 第一次观看时间
     */
    @ApiModelProperty(value = "创建时间")
    @DateTimeFormat(pattern = "yyyy-MM-ddHH:mm:ss")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    /**
     * 更新时间（最近一次观看时间）
     */
    @ApiModelProperty(value = "更新时间")
    @DateTimeFormat(pattern = "yyyy-MM-ddHH:mm:ss")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    @Override
    public String toString() {
        return "{" +
                "\"id\":" + id +
                ",\"trainingId\":" + trainingId +
                ",\"userId\":" + (userId == null ? null : "\"" + userId + "\"") +
                ",\"status\":" + status +
                ",\"createTime\":" + createTime +
                ",\"updateTime\":" + updateTime +
                "}";
    }
}